package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.importerpmapping.ImportErpMappingAddReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.importerpmapping.ImportErpMappingEditReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.importerpmapping.ImportErpMappingListReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.importerpmapping.ImportErpMappingListResVo;
import com.zmj.sy.mom.srv.aps.service.ImportErpMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "ERP-MES的关系映射表")
@RestController
@RequestMapping("/importErpMapping")
public class ImportErpMappingController {

    private final ImportErpMappingService importErpMappingService;

    @ApiOperation("添加")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody ImportErpMappingAddReqVo reqVo){
        importErpMappingService.add(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("列表")
    @GetMapping("/list")
    public BasePageResVo<ImportErpMappingListResVo> list(ImportErpMappingListReqVo reqVo){
        return importErpMappingService.list(reqVo);
    }

    @ApiOperation("修改")
    @PostMapping("/edit")
    public BaseResVo edit(@RequestBody ImportErpMappingEditReqVo reqVo){
        importErpMappingService.edit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("删除")
    @PostMapping("/delete")
    public BaseResVo delete(BaseIdReqVo reqVo){
        importErpMappingService.delete(reqVo);
        return BaseResVo.ok();
    }

}
